/*--------------------------------------------------------------
 * File: demo56.c 编码类型：C语言  UTF-8
 * Author WRS (1352509846@qq.com)
 * 功能: 连接字符串
 * Version 0.1
 * Date 2022-08-17 
 * 
 * @copyright Copyright (c) 2022
 * 
----------------------------------------------------------------*/
#include <stdio.h>

// 使用strcat连接两个字符串
int main(int argc, char const *argv[])
{
    char s1[100] = {0};
    char s2[100] = {0};
    int i = 0, j = 0;
        
    printf("输入第一个字符串：");
    scanf("%s",s1);
    printf("输入第二个字符串：");
    scanf("%s",s2);

    // 计算字符串s1长度
    for(i=0; s1[i]!='\0';i++);

    // 拼接字符串
    for(j=0; s2[j]!='\0'; j++,i++)
    {
        s1[i] = s2[j];
    }
    s1[i] = '\0';
    printf("连接后：%s\n",s1);

    return 0;
}
